home *** CD-ROM | disk | FTP | other *** search
- DISK / FILE routines look for specified files on your disk, or report
- disk status. Several QLIB disk/file subroutines return the following
- MS-DOS error codes:
-
- oops% = 1 file name is a nul string
- oops% = 2 file not found
- oops% = 3 path not found
- oops% = 4 too many open files
- oops% = 5 access denied (file may be read-only
- or a subdirectory, or subdirectory not empty)
- oops% = 19 disk is write-protected
-
- BIOS error codes, returned by DriveReady, are:
-
- oops% = 2 disk not readable (not formatted, or wrong type)
- oops% = 128 drive not ready
-
-
- File attributes may be combined. Each bit of the file attribute
- means:
-
- 0 = normal files
- 1 = read-only
- 2 = hidden files
- 4 = system files
- 8 = volume label (only one per disk - may not be
- reliable)
- 16 = subdirectories
- 32 = archive bit set
-
- Thus a file attribute of 18 is a hidden subdirectory (16 OR 2)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: CopyFile(FromFile$, ToFile$, oops%)
- object file: copyfile.obj (qalloc.obj)
-
- Copies a file from FromFile$ to ToFile$, and returns an error
- code if something went wrong. FromFile$ and ToFile$ may not include
- any wildcard characters (such as * and ?). CopyFile will destroy any
- previously-existing file named ToFile$ before copying the file.
- Oops% = -1 if an error in the "To" file was encountered; other error
- codes apply to the "From" file.
-
- Example:
- FromFile$ = "b:\qlib.lib"
- ToFile$ = "c:\qb4\qlib.lib"
- CALL CopyFile(FromFile$, ToFile$, oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: DriveReady(drv$, oops%)
- object file: drvready.obj
-
- DriveReady is used to determine if a floppy disk drive has a usable
- disk and is ready for use. DriveReady returns BIOS error codes, or
- oops% = 0 if the drive is ready. Oops% = -1 if drv$ is an invalid
- drive specification.
-
- Example:
- drv$ = "a:"
- CALL DriveReady(drv$, oops)
- IF oops% <> 0 THEN PRINT "Drive " + drv$ + "not ready or bad disk"
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: DriveSpace(drv$, total&, free&, oops%)
- object file: drvspace.obj
-
- Returns the amount of total and free space left on a given disk
- drive. The drive string may be any legal disk drive, or "@" (AT sign)
- for the default drive, and must be at least one character long. An
- illegal drive or other error will cause oops% to be returned as -1.
- Note that total& and free& are LONG integers. Works with logical
- devices up to 2,147 Megabytes.
-
- Example:
- drv$="C:"
- .
- .
- CALL DriveSpace(drv$, total&, free&, oops%)
- IF oops% = -1 THEN
- PRINT "Invalid drive specification"
- ELSE
- PRINT "Free space on drive "; drv$; " is"; free&; "bytes."
- PRINT "Total space on drive "; drv$; " is"; total&; "bytes."
- END IF
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: Exist(filename$, oops%)
- object file: exist.obj
-
- Tells you if a given file already exists. Returns an error code
- if it doesn't, or -1 if it does. Requires an ASCIIZ filename without
- wildcards.
-
- Example:
- filename$="TEST.TXT" + CHR$(0)
- CALL Exist(filename$, oops%)
- IF oops% = -1 THEN PRINT "File already exists"
- IF oops% = 0 THEN PRINT "Path exists"
- ' Filename$ = "d:\path" + CHR$(0)
- IF oops% = 2 THEN PRINT "Path found, file not found"
- IF oops% = 3 THEN PRINT "Path or file not found"
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FFlush (handle%)
- object file: fflush.obj (q$error.obj)
-
- Flushes the DOS file output buffer associated with handle%.
- The file must have been opened with QLIB's FOpen or FCreate functions.
- Flushing the file buffer protects against unintended system failures
- such as power outages. Any data written to the file before calling
- fflush will be safely written to the disk. FFlush also updates
- QLIB's DOSError flag.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- f$ = "anyold.fil" + CHR$(0)
- handle% = FCreate (f$)
- ' program writes data to the file
- .
- .
- .
- CALL FFlush (handle%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: count% = FileCount(s$, attr%)
- object file: findfile.obj
-
- Counts the number of files matching the filespec s$. S$ must be
- an ASCIIZ (zero-terminated) string and may contain the wildcard
- characters * and ?.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- s$ ="*.*" + CHR$(0) ' count all files in the current directory
- attr% = 0 ' normal files only
- count% = FileCount(s$, attr%)
-
-
-
-
- QLIB's file Input/Output subroutines provide fast, flexible file handling,
- replacing BASIC's clumsy functions. These subroutines return an error code
- (oops%) which is zero if no error occurred, or returns an MS-DOS error
- code if something went wrong.
-
- Below is a summary of QLIB's file I/O subroutines:
-
- FOpenR Open a file for input
- FOpenW Open a file for output
- FOpenRW Open a file for random access
- FCreate Make a new file and open it for I/O
- FClose Close a file opened by FOpen
-
- FileRead1 Read one byte from a file opened by FOpen
- FileRead2 Read 2 bytes from a file opened by FOpen
- FileRead4 Read 4 bytes from a file opened by FOpen
- FileRead8 Read 8 bytes from a file opened by FOpen
- FileRead Read from a file opened by FOpen to an array
-
- FileWrite1 Write one byte to a file
- FileWrite2 Write 2 bytes to a file
- FileWrite4 Write 4 bytes to a file
- FileWrite8 Write 8 bytes to a file
- FileWrite Write data to a file directly from an array
-
- FileBegin Reset the MS-DOS file pointer to the beginning of
- the file
- FileEnd Sets the MS-DOS file pointer to end of the file,
- to append data to the file
- FileSetPTR sets the file pointer for an open file to a specified
- byte position in the file
- FileMovPTR moves the file pointer forward or backward in the file
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileBegin(handle%, oops%)
- object file: fileptr.obj
-
- Sets the MS-DOS file pointer to the beginning of a file opened
- by FOpen. Handle% is the file handle returned by FOpen.
-
- Example:
- CALL FileBegin(handle%, oops%)
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FClose(handle%)
- object file: fopen.obj
-
- Closes a file opened by FOpen or FCreate. Handle% is the file
- handle returned by FOpen. FClose updates the DosError flag.
-
- Example:
- CALL FClose(handle%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: handle% = FCreate(file$)
- object file: fopen.obj
-
- Creates a new file and returns a handle for subsequent writing.
- If the file already exists, it will be truncated to zero bytes by
- FCreate. FCreate updates DosError.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- file$ = "anyold.dat" +CHR$(0)
- handle% = FOpenW(file$) ' first try to open an existing file
- IF DosError = 2 THEN
- handle% = FCreate(file$) ' create a new file if "anyold.dat"
- ' is not found
- ENDIF
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileEnd(handle%, oops%)
- object file: fileptr.obj
-
- Sets the MS-DOS file pointer at the end of the file. Subsequent
- FileWrite calls will add new data to the end of the file.
-
- Example:
- file$ = "anyfile.dat" + CHR$(0)
- acode = 1 ' I want to add new data to this file
- handle% = FOpenW(a$)
- CALL FileEnd(handle%, oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileMovPTR(handle%, bytes0&, bytes1&, oops)
- object file: fileptr.obj
-
- Moves the file pointer from its present position forward or
- backward in the file. The file must have been opened by FOpen
- or FCreate. Bytes0& is the number of bytes to move the pointer,
- and bytes1& is the resulting pointer location in the file. Note that
- bytes0& and bytes1& are LONG integers.
-
- Example:
- CALL FileMovPTR(handle%, bytes0&, bytes1&, oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: handle% = FOpenR(file$)
- Function: handle% = FOpenRW(file$)
- Function: handle% = FOpenW(file$)
- object file: fopen.obj
-
- The FOpen functions open an existing file for input, output or
- random I/O. With FOpenR, access is input (Read), FOpenW access
- is output, (Write) and FOpenRW access may be either input or output
- (Read/Write). File$ is an ASCIIZ (zero-terminated) file name. Handle%
- is the file handle returned by FOpen for use with subsequent input
- from or output to the file. When a file is opened by FOpen, the
- MS-DOS file pointer is positioned at the start of the file. Use
- FileEnd to position the pointer at the end of the file, for appending
- the file.
-
- Example:
- File$ = "anyold.fil" + CHR$(0)
- handle% = FOpenRW(file$)
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileRead(handle%, aSEG%, aPTR%, bytes0%, bytes1%, oops%)
- object file: fileio.obj
-
- Reads bytes0% bytes of data from a file opened by FOpen and
- loads the data into an array beginning at the address pointed to
- by aSEG% and aPTR%. bytes1% is the number of bytes actually read
- into the array. Unless FileRead encounters the end of the file,
- bytes1% should be the same as bytes0%.
-
- Example:
- DIM a(99) ' an integer array of 100 elements
- bytes0% = 200 ' each integer is 2 bytes
- file$ = "anyold.dat" + CHR$(0)
- handle% = FOpenR(file$)
- aSEG% = VARSEG(a(0)) ' start at beginning of file
- aPTR% = VARPTR(a(0))
- CALL FileRead(handle%, aSEG%, aPTR%, bytes0%, bytes1%, oops%)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileRead1(handle%, n%, bytes%, oops%)
- Subroutine: FileRead2(handle%, n%, bytes%, oops%)
- Subroutine: FileRead4(handle%, n& (or n!), bytes%, oops%)
- Subroutine: FileRead8(handle%, n#, bytes%, oops%)
- object file: filerw.obj
-
- FileRead[n] subroutines write a single data point to the file
- opened by FOpen. FileRead1 is intended for character or short
- integer data, FileRead2 is for INTEGER data, FileRead4 is for LONG
- or SINGLE data and FileRead8 is for DOUBLE or CURRENCY data. Note
- that SINGLE or DOUBLE data may be either IEEE format or Microsoft
- Binary Format. Bytes% returned by FileRead[n] will be 1, 2, 4, or 8
- to confirm proper function of the subroutine.
-
- Example:
- handle% = FOpenR(file$ + CHR$(0))
- .
- .
- .
- n& = 40000&
- CALL FileRead4(handle%, n&, bytes%, oops%)
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileSetPTR(handle%, bytes0&, bytes1&, oops%)
- object file: fileptr.obj
-
- Sets the current location of the file pointer for a file opened
- by FOpen or FCreate. Bytes0& is the desired position and bytes1&
- is returned by FileSetPTR. Note that bytes0& and bytes1& and LONG
- integers.
-
- Example:
- CALL FileSetPTR(handle%, bytes0&, bytes1&, oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileWrite(handle%, aSEG%, aPTR%, bytes0%, bytes1%, oops%)
- object file: fileio.obj
-
- Similar to FileRead, above, but writes to the file from the array.
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FileWrite1(handle%, n%, bytes%, oops%)
- Subroutine: FileWrite2(handle%, n%, bytes%, oops%)
- Subroutine: FileWrite4(handle%, n& (or n!), bytes%, oops%)
- Subroutine: FileWrite8(handle%, n#, bytes%, oops%)
- object file: filerw.obj
-
- Similar to FileRead[n], above, but writes data to the file.
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: s& = FSize (handle%)
- object file: fsize.obj (d$error.obj)
-
- Given a valid file handle returned by a QLIB FOpen
- subroutine, FSize returns the size of the file. Any DOS errors
- are flagged by DOSERROR (see DOSERROR in SYSTEM.DOC).
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- handle% = FOpenRW(file$)
- IF DOSERROR THEN . . . ' error control stuff
- s& = FSize(handle%)
- IF DOSERROR THEN . . . ' error control stuff
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: d$ = GetDRIVE
- object file: getdrive.obj
-
- Returns the default drive.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- .
- .
- .
- drive$ = GetDRIVE
- PRINT "The default drive is "; drive$
- REM drive$ includes the trailing colon, i.e., drive$ = "C:"
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: sub$ = GetSUB(d$)
- object file: getsub.obj (q$sdat.obj)
-
- Gets the current directory on disk d$. To get the current
- directory on the default drive, set d$ = "@". If d$ specifies an
- invalid drive, sub$ will be a nul string. NOTE: d$ must be at least
- one character long.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- d$ = "C:"
- sub$ = GetSUB(d$)
- IF sub$ = "" THEN PRINT d$ + " is not a valid drive"
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: FindFirstMatch(file$, fAttr%, oops%)
- Subroutine: FindNextMatch(oops%)
- Subroutine: FindFileName(filename$, flen%)
- Subroutine: FindFileAttr(fAttr%)
- Subroutine: FindFileDate(month%, day%, year%)
- Subroutine: FindFileTime(hour%, min%, sec%)
- Subroutine: FindFileSize(lowword%, highword%)
- object file: findfile.obj
-
- This group of subroutines may be used to search for files which match
- a specified file name. The specified file name may include drive and
- path, and may also include the * and ? wildcards. These subroutines may
- be used to duplicate the DOS DIR command.
-
- A search attribute (fAttr%) may also be specified. File attributes are
- listed on the first page of this file.
-
- fAttr% may include more than one type of file. For example, if
- fAttr% = 2 + 8, FindFirst/NextMatch will search for hidden and system
- files as well as normal files (normal files will always be found).
- The actual file attribute of the matched file will be returned by
- FindFileAttr. Files returned may have a combination of attributes; for
- example, if a file attribute returned by FindFileAttr is 18 ( = 2 + 16),
- this file is a hidden directory.
-
- The file size returned by FindFileSize is in two parts. Use the following
- code to determine the file size:
-
- CALL FindFileSize(lowword%, highword%) ' assumes file matched with
- ' FindFirst/NextMatch, oops% <> 0
- size& = CLNG(lowword%)
- IF lowword% < 0 THEN size& = size& + 65536&
- size& = size& + highword% * 65536&
-
- see examples on the next page
-
-
- Example 1:
- filename$ = SPACE$(12) ' filename$ must be initialized
- ' as a 12-byte (or longer) string
- ' or the namelen% will be returned
- ' as -1
- FileSpec$ = "\qb4\*.bas"+CHR$(0) ' FileSpec$ must end in CHR$(0)
- fAttr% = 0 ' search only for normal files
- CALL FindFirstMatch(FileSpec$, fAttr%, oops%)
- IF oops% = -1 THEN PRINT "FileSpec$ is a nul string"
- IF oops% THEN PRINT "No matching files"
- WHILE oops% = 0
- CALL FindFileName(filename$, namelen%)
- IF namelen% = -1 THEN PRINT "filename$ shorter than 12 bytes"
- PRINT LEFT$(filename$, namelen%)
- CALL FindNextMatch(oops%)
- WEND
- REM FindFileName, FindFileAttr, FindFileDate, FindFileTime and
- REM FindFileSize will return usable results only after a successful
- REM (oops% = 0) call to FindFirstMatch or FindNextMatch.
-
- Example 2:
- REM In this example, we will print all subdirectories one
- REM level down from the root directory
- filename$ = SPACE$(12) ' filename$ must be initialized
- ' as a 12-byte (or longer) string
- fAttr% = 16
- FileSpec$ = "\*.*"+CHR$(0)
- CALL FindFirstMatch(FileSpec$, fAttr%, oops%)
- IF oops% THEN PRINT "No files or subdirectories"
- WHILE oops% = 0
- CALL FindFileAttr(fAttr%)
- IF fAttr% AND 16 THEN
- CALL FindFileName(filename$, namelen%)
- PRINT LEFT$(filename$, namelen%)
- END IF
- CALL FindNextMatch(oops%)
- WEND
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: fseg% = FLoad (filename$ + CHR$(0))
- object files: fload.obj, q$alloc.obj, q$error.obj
-
- FLoad reads a specified file into far memory, returning the segment
- address of the memory block where the file is located. If an error
- occurs when reading the file, FLoad returns fseg% = 0. QLIB's
- DOSERROR flag is also updated (see DOSERROR in SYSTEM.DOC).
- If no error occurred, DOSERROR returns 0; otherwise it returns an
- MS-DOS error code. If fseg% = 0 and DOSERROR = 0 then insufficient
- far memory is available.
-
- Example:
- REM $INCLUDE: '\qb4\qlib.bi'
- filename$ = "\ramfont\italics.fnt" + CHR$(0)
- iseg% = fload (filename$)
- IF DOSError THEN
- .
- .
- . ; error handling code
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: GetFileAttr(file$ + CHR$(0), attr%, oops%)
- object file: fileattr.obj
-
- Returns the attribute of file$. File$ must be an ASCIIZ
- (zero-terminated) string without the * or ? wildcards. File
- attributes are listed on the first page of this file. Oops%
- is an MS-DOS error code if something went wrong, or oops% = -1
- if no problems were encountered.
-
- Example:
- file$ = "c:\qb4\qlib.lib" + CHR$(0)
- CALL GetFileAttr(file$, attr%, oops%)
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: KillFile(file$ + CHR$(0), oops%)
- object file: killfile.obj
-
- KillFile deletes file$ from a disk with error trapping, avoiding
- BASIC's ON ERROR. Note that the file name string passed to the
- subroutine is an ASCIIZ (zero-terminated) string. Oops% = 0 if
- no error; MS-DOS error codes apply if oops% <> 0.
-
- Example:
- file$ = "oldfile.dat" + CHR$(0)
- CALL KillFile(file$, oops%)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: KillSUB(sub$ + CHR$(0), oops%)
- object file: killfile.obj
-
- KillSUB deletes subdirectory sub$ from a disk with error trapping,
- avoiding BASIC's ON ERROR. Note that the directory name string passed
- to the subroutine is an ASCIIZ (zero-terminated) string. The
- subdirectory must be empty before it is deleted. Oops% = 0 if
- no error; MS-DOS error codes apply if oops% <> 0.
-
- Example:
- sub$ = "C:\123" + CHR$(0)
- CALL KillSUB(sub$, oops%)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: MakeSUB(sub$ + CHR$(0), oops)
- object file: killfile.obj
-
- Creates a new subdirectory. Oops% is an MS-DOS error code returned
- by MakeSUB. If oops% = 0 then no error was detected.
-
- Example:
- sub$ = "\qb4\qlib" ' make a new subdirectory for QLIB
- CALL MakeSUB(sub$ + CHR$(0), oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: Rename(old$, new$, oops)
- object file: rename.obj
-
- Changes filename old$ to new$, returning an MS-DOS error code.
- Similar to BASIC's NAME function, but does not require ON ERROR
- to trap errors. Note that both old$ and new$ must be zero-terminated
- ASCIIZ strings. You may use Rename to move a file from one directory
- to another on the same disk.
-
- Example:
- old$ = "demo.bas" + CHR$(0)
- new$ = "demo.bak" + CHR$(0)
- CALL Rename(old$, new$, oops)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: SetDRIVE(d$)
- object file: setdrive.obj
-
- Sets d$ as the default drive. D$ may be any valid disk drive or
- other logical device (such as a RAMdisk).
-
- Example:
- d$ = "a:" ' the drive specifier d$ may be upper or lower
- ' case and need not include the colon.
- CALL SetDRIVE(d$) ' drive A: is now the default drive
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: SetFileAttr(file$ + CHR$(0), attr%, oops%)
- object file: fileattr.obj
-
- Changes the file attribute of file$. File attributes are
- described on the first page of this file. Oops% returned by this
- subroutine is an MS-DOS error code (see first page of this file).
- If all O.K. then oops% = -1.
-
- Example: I want to make my QLIB.LIB file read-only
-
- REM I start by getting the present attribute
- file$ = "QLIB.LIB" + CHR$(0)
- CALL GetFileAttr(file$, attr%, oops%)
- IF oops% <> -1 THEN
- REM Uh oh, something went wrong
- .
- .
- .
- END IF
-
- REM now I'll add the Read-only bit to the attribute
- attr% = attr% OR 1
- CALL SetFileAttr(file$, attr%, oops%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: SetFileDate(file$, month%, day%, year%, hour%, min%, sec%)
- object file: setfdate.obj
-
- Sets file time/date stamp. The filename must be an ASCIIZ (zero-
- terminated) string. The year may be either a four digit or two digit
- number (e.g., either 1986 or just 86). DOS will round the seconds
- value off to the next lower even number. If there is a problem with
- the filename, or if the file is read-only, the month will be returned
- as -1. Note that midnight is 24:00. If hour%, minute% and second% are
- all 0, then the file's time will not be displayed in a directory list.
-
- Example:
- file$ = "anyfile.dat" + CHR$(0)
- CALL SetFileDate(file$, month%, day%, year%, hour%, min%, sec%)
-
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: SetSUB(sub$ + CHR$(0), oops%)
- object file: killfile.obj
-
- Changes the default subdirectory to sub$. Oops% is an error
- code returned to BASIC.
-
- SetSUB's error codes:
-
- oops% = 0 no error
- 1 subdirectory name is a nul string
- 3 path not found
-
- Note that sub$ is an ASCIIZ (zero-terminated) string.
-
- Example:
- directory$ = "\qb4\lib" + CHR$(0)
- CALL SetSUB(directory$, oops%)
-
-
-